

const Cu = Components.utils;
function require(url) {
    let scope = {};
    Cu.import(url, scope);
    return scope;
}
let {Prefs} = require("chrome://jsm/content/Preferences.js");
let {Dialogs} = require("chrome://jsm/content/Dialogs.js");
let {OS} = require("resource://gre/modules/osfile.jsm");

function confirmCopy() {
    if("arguments" in window && window.arguments.length > 0) {
        window.arguments[0].copy = true;
        window.arguments[0].path = document.getElementById("demo-folder").value;
    }
    window.close();
}


function cancelCopy() {
    if("arguments" in window && window.arguments.length > 0) {
        window.arguments[0].copy = false;
    }
    window.close();
}




function browseForFolder() {
    let textbox = document.getElementById("demo-folder");
    Dialogs.browseForFolder("iMacros", textbox.value).then(
        path => (textbox.value = path)
    );
}


window.onload = function () {
    let demo_folder = document.getElementById("demo-folder").value = 
        OS.Path.join(Prefs.defaultMacroPath, "Demo-Firefox");
};

